100 (null) 105 PRINT" THIS PROGRAM CREATES A PIE CHART." 110 PRINT" RAW DATA TO BUILD THE CHART COMES FROM" 115 PRINT" -DATA- STATEMENTS. BY CHANGING THE" 120 PRINT" INFORMATION IN THE -DATA- STATMENTS" 125 PRINT" DIFFERENT PIE CHARTS CAN BE CREATED." 130 PRINT 135 PRINT" TO MAKE NEW CHARTS, ALTER THE -DATA-" 140 PRINT" STATEMENTS STARTING AT LINE# 1000," 145 PRINT" AND ALSO THE VARIABLE -NE- (NUMBER OF" 150 PRINT" ELEMENTS) IN LINE# 515." 155 PRINT 160 PRINT" PRESS ANY KEY TO START." 165 PRINT 170 : 200 A$=(null)(1) 205 : 500 (null)5:(null)14,1:(null)6,2,5 505 (null) 320,-240,160,-120 510 RD=75 :REM CIRCLE RADIUS 515 NE=6 :REM NUMBER OF ELEMENTS 520 DIM VE(NE),NM$(NE) 525 GOSUB 905 530 GOSUB 1905 535 GOSUB 2005 540 GOSUB 2105 545 GOSUB 2205 550 GOSUB 2305 555 GOSUB 2405 560 : 565 A$=(null)(1) 570 : 575 (null) 0: (null)14,6: (null) 14 580 END 585 : 900 REM *READ RAW VALUES 905 TV=0 910 FOR I=1 TO NE 915 READ VE(I),NM$(I) 920 TV=TV+VE(I) 925 NEXT 930 READ TT$,BT$ 935 RETURN 940 : 1000 REM *RAW CHART DATA 1005 DATA 3,WIDGETS 1010 DATA 6,THINGEES 1015 DATA 17,GADGETS 1020 DATA 8,WHATSITS 1025 DATA 9,WHOSITS 1030 DATA 4,WHERESITS 1035 : 1100 REM *CHART TITLES 1105 DATA"UBIQUITOUS PIE CHART CO." 1110 DATA"YEARLY SALES" 1115 : 1900 REM *SORT VALUES 1905 FOR I=1 TO NE-1 1910 FOR J=I+1 TO NE 1915 IF VE(I)>VE(J) THEN (null) VE(I),VE(J): (null) NM$(I),NM$(J) 1920 NEXT 1925 NEXT 1930 RETURN 1935 : 2000 REM 0*MAKE CIRCLE 2005 (null) 0,RD 2010 (null) 0,-RD 2015 (null) RD,0 2020 (null) -RD,0 2025 FOR I=1/RD TO (null)/4 STEP 1/RD 2030 B=RD*COS(I) 2035 C=RD*SIN(I) 2040 (null) B,C: (null) -B,C 2045 (null) B,-C: (null) -B,-C 2050 (null) C,B: (null) -C,B 2055 (null) C,-B: (null) -C,-B 2060 NEXT 2065 RETURN 2070 : 2100 REM 0*MAKE SLICES 2105 A=0 2110 FOR I=1 TO NE 2115 A=A+VE(I) 2120 B=2*(null)*A/TV+(null)/2 2125 (null) 0,0 2130 (null) RD*COS(B),RD*SIN(B) 2135 NEXT 2140 RETURN 2145 : 2200 REM 0*SHADE SLICES 2205 A=0 2210 FOR I=1 TO NE 2215 B=((null)*(4*A+2*VE(I)+TV))/(2*TV) 2220 A=A+VE(I) 2225 (null) RD/2*COS(B),RD/2*SIN(B) 2230 (null) 63-63*A/TV 2235 NEXT 2240 RETURN 2245 : 2300 REM 0*LABEL SLICES 2305 A=0 2310 FOR I=1 TO NE 2315 B=((null)*(4*A+2*VE(I)+TV))/(2*TV) 2320 A=A+VE(I) 2325 C=(RD+RD/10)*COS(B) 2330 D=(RD+RD/10)*SIN(B) 2335 IFC<0THENC=C-8*LEN(NM$(I)) 2340 IFC=0THENC=C-4*LEN(NM$(I)) 2345 (null) C,D+4 2350 (null) NM$(I) 2355 NEXT 2360 RETURN 2365 : 2400 REM *MAIN TITLES 2405 (null) -(LEN(TT$)*8)/2,112 2410 (null) "[138]";TT$ 2415 (null) -(LEN(BT$)*8)/2,-96 2420 (null) "[138]";BT$ 2425 RETURN 2430 :